<div class="SipeiInfo pt20"><!--阅卷准备_03理员任务维护_编辑-->
         	<?php
         	$form = $this->beginWidget('CActiveForm', array(
         	'action' => $this->createUrl('/task/default/taskadd'),
         	'method' => 'POST',
         	'id' => 'searchForm',
         	'htmlOptions'=>array('target'=>'ajax-frame')
         	));
	?>
          
        <?php
        $task_id = '';
        $task_name = '';
        $exam_id = '';
        $task_expired = date('Y-m-d');
        $user_id = '';
        $task_status = '';
        ?>
        <table class="fontc_666 height32"> 
            <tbody>
            <input type="hidden" value="<?php echo $task_id; ?>" name ="task_id">
            <tr height="55">
                <td valign="top" width="145" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>任务描述：</td>
                <td valign="top" width="330" class="formValidator_td">
                    <input type="text" value="<?php echo $task_name; ?>" name="task_name" id="task_name" class="col3 pt5 pr10 pb5 pl10 height20 border_c border_3 fontc_666" />
                    <div class="formValidator_tip">
                        <p id="task_nameTip" ></p>
                    </div>
                </td>
            </tr>
            <tr height="55">
                <td valign="top" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>所属考试项目：</td>
                <td valign="top" class="formValidator_td">
                    <span class="fl standard_select pt5 pr7 pb5 pl3 border_c border_3">
                        <span class="fl select_shelter">
                            <select class="fl fontc_666" name="exam_id" id="exam_id">
                                <option value="">请选择</option>
                                <?php if ($exam): foreach ($exam as $one): ?>
                                        <option value="<?php echo $one['exam_id']; ?>" <?php
                                        if ($one['exam_id'] == $exam_id) {
                                        	echo "selected";
                                        }
                                        ?>><?php echo $one['exam_term_name']; ?></option>
                                                <?php
                                                endforeach;
                                                endif;
                                        ?>
                            </select>
                        </span>
                    </span>
                    <div class="formValidator_tip">
                        <p id="exam_idTip" ></p>
                    </div>
                </td>
            </tr>
            <tr height="55">
                <td valign="top" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>截止日期：</td>
                <td valign="top" class="formValidator_td">
                    <input type="text" name='task_expired' id="task_expired" value="<?php echo $task_expired; ?>" class="w140 pt5 pr5 pb5 pl10 height20 border_c border_3 fontc_666 SipeiTime" onfocus="WdatePicker()" />
                    <div class="formValidator_tip">
                        <p id="task_expiredTip" ></p>
                    </div>
                </td>
            </tr>
            <tr height="55">
                <td valign="top" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>责任人：</td>
                <td valign="top" class="formValidator_td">
                    <span class="fl standard_select pt5 pr7 pb5 pl3 border_c border_3">
                        <span class="fl select_shelter select_shelter2">
                            <select class="fl fontc_666" name="user_id" id="user_id">
                                <option value="">请选择</option>
                                <?php if ($user): foreach ($user as $one): ?>
                                        <option value="<?php echo $one['id']; ?>" <?php
                                        if ($one['id'] == $user_id) {
                                        	echo "selected";
                                        }
                                        ?>><?php echo $one['username']; ?></option>
                                                <?php
                                                endforeach;
                                                endif;
                                        ?>
                            </select>
                        </span>
                    </span>
                    <div class="formValidator_tip">
                        <p id="user_idTip" ></p>
                    </div>
                </td>
            </tr>
            <tr height="55">
                <td valign="top" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>任务状态：</td>
                <td valign="top" class="formValidator_td">
                    <span class="fl standard_select pt5 pr7 pb5 pl3 border_c border_3">
                        <span class="fl select_shelter select_shelter2">
                            <select class="fl fontc_666" name="task_status" id="task_status">
                                <option value="">请选择</option>
                                <option value="1" <?php
                                if ($task_status == 1) {
                                	echo "selected";
                                }
                                ?>>完成</option>
                                <option value="2" <?php
                                if ($task_status == 2) {
                                	echo "selected";
                                }
                                ?>>未完成</option>
                            </select>
                        </span>
                    </span>
                    <div class="formValidator_tip">
                        <p id="task_statusTip" ></p>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center" class="pb20">
                    <input type="submit" value="保存" class="b_a_n border_3 back_bgfb w80 height32 fontc_FFF fonts_12 mr10 cursor" />
                    <input type="button" value="取消" onclick="api.close()" class="b_a_n border_3 back_bgb w80 height32 fontc_FFF fonts_12 cursor" />
                </td>
            </tr>
            </tbody>
        </table>
   <?php
   $this->endWidget();
	?>
</div>
<iframe src='' style="display:none" name='ajax-frame'></iframe>
<script>
$(function(){
	$.formValidator.initConfig({formID:"searchForm",theme:"126",submitOnce:false,
	onError:function(msg,obj,errorlist){
		$("#errorlist").empty();
		$.map(errorlist,function(msg){
			$("#errorlist").append("<li>" + msg + "</li>")
		});
		alert(msg);
	}
	});

	/*任务描述验证*/
	$("#task_name").formValidator({
		onShowText:"请输入任务描述",
		onShow:"",
		onFocus:"",
		onCorrect:"输入正确",
		leftTrim:true,
		rightTrim:true
	}).inputValidator({
		min:1,
		max:20,
		onError:"任务描述长度在1-20之间(1到10个汉字)"
	});

	/*考试项目验证*/
	$("#exam_id").formValidator({
		onShowText:"",
		onShow:"",
		onFocus:"",
		onCorrect:"选择正确"
	}).inputValidator({
		min:1,
		onError:"请选择考试项目"
	});

	/*截止日期验证*/
	$("#task_expired").formValidator({
		onShowText:"",
		onShow:"",
		onFocus:"",
		onCorrect:"选择正确"
	}).inputValidator({
		min:1,
		onError:"请选择截止日期"
	});

	/*责任人验证*/
	$("#user_id").formValidator({
		onShowText:"",
		onShow:"",
		onFocus:"",
		onCorrect:"选择正确"
	}).inputValidator({
		min:1,
		onError:"请选择责任人"
	});

	/*任务状态验证*/
	$("#task_status").formValidator({
		onShowText:"",
		onShow:"",
		onFocus:"",
		onCorrect:"选择正确"
	}).inputValidator({
		min:1,
		onError:"请选择任务状态"
	});
})
</script>
<?php exit; ?>